package com.rao.crm.domain;

import java.util.List;

/**
 * @author Srao
 * @version 1.0
 * @className PageBean
 * @date 2019/9/19 20:37
 * @package com.rao.crm.domain
 * @description
 */
public class PageBean<T> {
    private Integer currPage;//当前页
    private Integer totalCount;//总记录数
    private Integer pageSize;//页大小
    private Integer startIndex;//起始索引
    private Integer totalPage;//总页数
    private List<T> list;//页内封装的对象

    public PageBean() {
    }

    public PageBean(Integer currPage, Integer totalCount, Integer pageSize) {
        this.currPage = currPage;
        this.totalCount = totalCount;
        this.pageSize = pageSize;

        this.startIndex = (currPage - 1) * pageSize;
        this.totalPage = ((Double)Math.ceil(totalCount.doubleValue() / pageSize)).intValue();
    }

    public Integer getCurrPage() {
        return currPage;
    }

    public void setCurrPage(Integer currPage) {
        this.currPage = currPage;
    }

    public Integer getStartIndex() {
        return startIndex;
    }

    public void setStartIndex(Integer startIndex) {
        this.startIndex = startIndex;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
